<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

defined('IN_ADMIN') or die('Hacking Attempt!');

func::isLogin();

mysql::begin(0);

$sTable = 'setting';

if(!isset($_POST['updateSettingButton'])){
    $sSql = 'SELECT * FROM '. $sTable;
    $aResult = mysql::querySql($sSql);
    $aRow = mysql::fetchSql($aResult);
} else{
    $aVals = array(
        'sitename' => isset($_POST['sitename']) ? func::cleanString($_POST['sitename']) : '',
        'slogan' => isset($_POST['slogan']) ? func::cleanString($_POST['slogan']) : '',
        'copyright' => isset($_POST['copyright']) ? func::cleanString($_POST['copyright']) : '',
        'author' => isset($_POST['author']) ? func::cleanString($_POST['author']) : '',
        'version' => isset($_POST['version']) ? func::cleanString($_POST['version']) : ''
    );
    $iIdUpdateSetting = mysql::updateSql($sTable, $aVals, 'settingId', 1);
    if($iIdUpdateSetting)
        func::redirect(func::makeUrl('index'));
}
?>
